// Author: Bjorn Schobben

#ifndef PAINTPALETTEWIDGET_H
#define PAINTPALETTEWIDGET_H

#include <QWidget>
#include <QGridLayout>
#include <QFrame>
#include <QPainter>
#include <QVBoxLayout>
#include "Properties.h"
#include "ColorButton.h"

// Widget for human player to select colors
class PaintPaletteWidget: public QWidget
{
	Q_OBJECT

public:
	//Constructor
	PaintPaletteWidget(QWidget *parent, const Properties& properties);

	//Destructor
	virtual ~PaintPaletteWidget();

protected:
	// Set the palette's current color
	void SetPaletteColor(Color color);

signals:
	// Raise signal for when color was changed
	void colorChanged(Color);
	// Raise signal for when the cursor was changed
	void cursorChanged(const QCursor&);

private slots:
	// Slots for the color buttons
	void SelectedColor(ColorButton* button, Color color);

private:
	// Setup the dialog ui
	void SetupUi(const Properties& properties);

	// Helper function to color the image with a new color
	void SetImageColor(QImage& image, Color color);
	// Helper function to setup the color buttons
	void SetupColorButtons(const Properties& properties);

    QGridLayout *gridLayout;
    QFrame *frame;
    QVBoxLayout *vboxLayout;
};

#endif //PROPERTIESDIALOG_H